package com.jwell.bigdata.ui.menu

import android.app.Activity
import android.content.DialogInterface
import android.content.Intent
import android.content.pm.ActivityInfo
import android.os.Bundle
import android.util.Log
import android.view.KeyEvent
import android.widget.Toast
import com.jwell.bigdata.R
import com.jwell.bigdata.base.BaseActivity
import com.jwell.bigdata.ui.dialog.NoTitleDialog
import com.jwell.bigdata.ui.web.WebActivity
import kotlinx.android.synthetic.main.activity_menu.*

class MenuActivity :Activity() {
    companion object {
        fun startActivity(token:String,activity: Activity) {
            val intent = Intent(activity, MenuActivity::class.java)
            intent.putExtra("token",token)
            activity.startActivity(intent)
        }
//        val URL_LENG="http://datav.aliyuncs.com/share/b4dd11ea045b765a1139b6ec93435818?spm=datav.10712494.0.0.32dd4a9aKNIudE&whatever=true"
        val URL_LENG="http://datav.aliyuncs.com/share/b4dd11ea045b765a1139b6ec93435818"
//        val URL_LENG2="http://47.101.60.168/tml/detectionscreen1"
        val URL_LENG2="http://datav.aliyuncs.com/share/8a66a78ad64c36bf05b70a471a1f8ae8"
//        val URL_LENG2="http://47.101.60.168/tml/detectionscreen1"
//        val URL_LIAN="http://datav.aliyuncs.com/share/eed617bb011100080dd56af74a821b64?spm=datav.10712494.0.0.8b3e4a9aWOpAuE&whatever=true"
        val URL_LIAN="http://datav.aliyuncs.com/share/a3aefe074124404519292b1fbc842aca"
//        val URL_LIAN="https://47.111.65.28/checkpreload.htm"
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        requestedOrientation=ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
        setContentView(R.layout.activity_menu)
        var token=intent.getStringExtra("token")
        System.out.println("CookieString-$token")
        tv_leng.setOnClickListener {
            WebActivity.startActivity(URL_LENG, token,MenuActivity@this)
        }
        tv_lian.setOnClickListener {
            WebActivity.startActivity(URL_LIAN, token, MenuActivity@this)
        }
        tv_leng2.setOnClickListener {
            WebActivity.startActivity(URL_LENG2, token, MenuActivity@this)
        }
    }

    override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
        if(keyCode==KeyEvent.KEYCODE_BACK)
        {
            moveTaskToBack(true)
            return true
        }
        return super.onKeyDown(keyCode, event)
    }
}